package com.yxy.ms.manager.entity.po;

import java.io.Serializable;
import java.util.Date;

import com.yxy.ms.manager.utils.MethodUtils;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <类描述>数据异常表记录实体
 *
 * @author whd
 */
@Getter
@Setter
@Accessors(chain = true)
public class ErrorData implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 3779513841812856100L;

    /**
     * 主键 uuid
     */
    private String id;

    /**
     * 对应各业务表的mid
     */
    private Long transMid;

    /**
     * 原文件名
     */
    private String fileName;

    /**
     * zip包内的子文件名
     */
    private String childName;

    /**
     * 异常类型 0、数据校验不合规 1、json数据文件不合规 2、zip数据包不合规 3、其它(写入时记录明细)
     */
    private Integer errType;

    /**
     * 异常信息说明 json格式
     */
    private String errDesc;

    /**
     * 交易类型 1门架 2入口 3出口 4车牌识别 5门架心跳 6车道心跳 7车道、门架统计数据 8 清分上传 9 清分下载
     */
    private Integer transType;

    /**
     * 原数据 json格式字符串
     */
    private String dataJson;

    /**
     * 状态 0待处理（默认） 1 已处理 2失败（放弃处理或处理失败）
     */
    private Integer status;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date modifyTime;

    /**
     * 车牌识别流水号
     */
    private String picId;

    /**
     * 计费交易编号，交易数据错误时必填
     */
    private String tradeId;

    /**
     * 车道：广场ID 门架：门架内部编号
     */
    private Integer plazaId;

    /**
     * 车道号,实则laneno
     */
    private Integer laneId;

    /**
     * 收费员id
     */
    private Integer operatorId;

    /**
     * 子班次开始时间
     */
    private Date shiftBeginTime;

    /**
     * 班次id
     */
    private Integer shiftId;

    /**
     * 交易时间 门架：trans_time
     */
    private Date transOccurTime;

    /**
     * 班次日 格式:YYYY-MM-DD 00:00:00
     */
    private Date acWhen;

    /**
     * 数据来源 与车道类型无关，参照表f40_data_source 0、普通交易 1、天线交易 2、etc机具交易 3、etc交易补录写入 4、mtc交易补录写入 5、回收通行券交易 6、现金冲账交易 7、移动支付
     * 8、移动支付补录冲账交易 9、mtc机具交易 默认值：-1
     */
    private Integer datasource;

    public ErrorData() {
        this.id = MethodUtils.getUUID();
    }

    public ErrorData(Integer status) {
        this.id = MethodUtils.getUUID();
        this.status = status;
    }

    // 异常信息调取所需构造
    public ErrorData(Integer errType, Integer transType) {
        this.id = MethodUtils.getUUID();
        this.errType = errType;
        this.transType = transType;
        this.status = 0;
    }

    public ErrorData(Object objId, Integer errType, String dataJson, Integer transType, Integer plazaId,
        String oldFileName) {
        this.id = MethodUtils.getUUID();
        if (null != objId) {
            if (objId instanceof java.lang.String) {
                this.picId = (String)objId;
            } else if (objId instanceof java.lang.Long) {
                this.transMid = (Long)objId;
            }
        }
        this.errType = errType;
        this.transType = transType;
        this.dataJson = dataJson;
        this.plazaId = plazaId;
        this.fileName = oldFileName;
        this.status = 0;
    }

    public ErrorData(Object objId, Integer errType, String dataJson, Integer transType, Integer plazaId, String tradeId,
        Date transOccurTime, Integer datasource, String oldFileName) {
        this.id = MethodUtils.getUUID();
        if (null != objId) {
            if (objId instanceof java.lang.String) {
                this.picId = (String)objId;
            } else if (objId instanceof java.lang.Long) {
                this.transMid = (Long)objId;
            }
        }
        this.errType = errType;
        this.transType = transType;
        this.dataJson = dataJson;
        this.plazaId = plazaId;
        this.tradeId = tradeId;
        this.transOccurTime = transOccurTime;
        this.datasource = datasource;
        this.fileName = oldFileName;
        this.status = 0;
    }

    public ErrorData(Object objId, Integer errType, String dataJson, Integer transType, Integer plazaId, Integer laneId,
        Integer operatorId, Date shiftBeginTime, Integer shiftId, Date acWhen, String oldFileName) {
        this.id = MethodUtils.getUUID();
        if (null != objId) {
            if (objId instanceof java.lang.String) {
                this.picId = (String)objId;
            } else if (objId instanceof java.lang.Long) {
                this.transMid = (Long)objId;
            }
        }
        this.errType = errType;
        this.transType = transType;
        this.dataJson = dataJson;
        this.plazaId = plazaId;
        this.laneId = laneId;
        this.operatorId = operatorId;
        this.shiftBeginTime = shiftBeginTime;
        this.shiftId = shiftId;
        this.acWhen = acWhen;
        this.fileName = oldFileName;
        this.status = 0;
    }

    public ErrorData(Object objId, Integer errType, String dataJson, Integer transType, Integer plazaId, Integer laneId,
        String oldFileName) {
        this.id = MethodUtils.getUUID();
        if (null != objId) {
            if (objId instanceof java.lang.String) {
                this.picId = (String)objId;
            } else if (objId instanceof java.lang.Long) {
                this.transMid = (Long)objId;
            }
        }
        this.errType = errType;
        this.transType = transType;
        this.dataJson = dataJson;
        this.plazaId = plazaId;
        this.laneId = laneId;
        this.fileName = oldFileName;
        this.status = 0;
    }

}